package com.kuzufang.modules.publish;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.kuzufang.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by songyuanjin on 2017/10/11.
 */

public class EntireRentRoomStyleAdapter extends RecyclerView.Adapter<EntireRentRoomStyleAdapter.RentRoomViewHolder> {
    private Context mCtx;
    private List<String> roomStyles = new ArrayList<>();

    public EntireRentRoomStyleAdapter(Context context) {
        this.mCtx = context;
        roomStyles.add("单身公寓");
        roomStyles.add("一室一厅");
        roomStyles.add("两室一厅");
        roomStyles.add("三室一厅");
    }

    @Override
    public RentRoomViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mCtx).inflate(R.layout.item_entire_room_style, parent, false);
        return new RentRoomViewHolder(view);
    }

    @Override
    public void onBindViewHolder(RentRoomViewHolder holder, int position) {
        String roomStyle = roomStyles.get(position);
        holder.roomStyleTextView.setText(roomStyle);
    }

    @Override
    public int getItemCount() {
        return roomStyles.size();
    }

    class RentRoomViewHolder extends RecyclerView.ViewHolder {
        private TextView roomStyleTextView;

        public RentRoomViewHolder(View itemView) {
            super(itemView);

            roomStyleTextView = (TextView) itemView.findViewById(R.id.tv_room_style);
        }
    }

}
